function Set-InsightServer {
    [CmdletBinding()]
    [OutputType('Microsoft.Azure.Commands.Sql.Server.Model')]
    param (
        [Parameter(Mandatory = $true)][LSInsightServer]$Server,
        [Parameter(Mandatory = $true)][string][ValidateScript({ !([string]::IsNullOrWhiteSpace($_)) })]$Location,
        [Parameter(Mandatory = $true)][string][ValidateScript({ !([string]::IsNullOrWhiteSpace($_)) })]$ResourceGroup,
        [Parameter(Mandatory = $true)][string][ValidateScript({ !([string]::IsNullOrWhiteSpace($_)) })]$ClientIPAddress,
        [Parameter(Mandatory = $true)][string][ValidateScript({ $_ -ne 'Undefined' })]$Placement
    )

    $NewServer = $null
    
    # Create server if necessary.
    if ($Placement -eq 'In_Azure' -and $Server.UseExisting -eq 'False') {
        Write-Host # Newline.
        Write-Host "Creating a new Azure SQL server. This might take a few minutes..."
        $params = @{
            Server = $Server
            Location = $Location
            ResourceGroup = $ResourceGroup
        }
        $NewServer = New-AzureSQLServer @params
    }

    # Create firewall rules if necessary.
    if ($Placement -eq 'In_Azure') {
        Write-Host # Newline.
        Write-Host "Adding firewall rules..."
        $params = @{
            ServerName = $Server.Name
            ResourceGroup = $ResourceGroup
            ClientIPAddress = $ClientIPAddress
        }
        New-AzureFirewallRules @params
    }

    return $NewServer
}